//
//  AchievementStore.m
//  NewPro
//
//  Created by 何荧红 on 2019/5/5.
//  Copyright © 2019 何荧红. All rights reserved.
//

#import "AchievementStore.h"

@implementation AchievementStore

#pragma mark 获取业绩数量
- (void)GetAmountSuccess:(void(^)(NSDictionary *res))success Failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@/api/custom/v1/performance/agg",IP];
    [HttpTool getUrlWithString:url parameters:@{} success:^(id responseObject) {
        NSError *erro = [HttpTool inspectError:responseObject];
        if (erro == nil) {
            success(responseObject);
        }else{
            failure(erro);
        }
    } failure:^(NSError *error) {
        failure(error);
    }];
}

#pragma mark 获取业绩首页
- (void)GetAchievementWithPrams:(NSDictionary *)prams Success:(void(^)(NSDictionary *res))success Failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@/api/custom/v1/performance",IP];
    [HttpTool getUrlWithString:url parameters:prams success:^(id responseObject) {
        NSError *erro = [HttpTool inspectError:responseObject];
        if (erro == nil) {
            success(responseObject);
        }else{
            failure(erro);
        }
    } failure:^(NSError *error) {
        failure(error);
    }];
}

#pragma mark 获取业绩详情
- (void)GetAchievementDetailWithPrams:(NSDictionary *)prams Success:(void(^)(NSDictionary *res))success Failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@/api/v1/perform/detail",IP];
    [HttpTool getUrlWithString:url parameters:prams success:^(id responseObject) {
        NSError *erro = [HttpTool inspectError:responseObject];
        if (erro == nil) {
            success(responseObject);
        }else{
            failure(erro);
        }
    } failure:^(NSError *error) {
        failure(error);
    }];
}



@end
